//
//  UIViewController+AZURLRouter.m
//  AZRouter
//
//  Created by G-Xi0N on 2018/4/3.
//  Copyright © 2018年 gaoX. All rights reserved.
//

#import "UIViewController+AZURLRouter.h"
#import "AZURLRouter.h"

@implementation UIViewController (AZURLRouter)

- (void)openURL:(NSString * _Nonnull)URLString
{
    [self openURL:URLString parameters:nil];
}

- (void)openURL:(NSString * _Nonnull)URLString
     parameters:(NSDictionary<NSString *, id> * _Nullable)parameters
{
    [self openURL:URLString parameters:parameters animated:YES configuration:nil];
}

- (void)openURL:(NSString * _Nonnull)URLString
     parameters:(NSDictionary<NSString *, id> * _Nullable)parameters
       animated:(BOOL)animated
  configuration:(void (^)(UIViewController *))configuration
{
    NSURL *url = [NSURL URLWithString:URLString relativeToURL:[AZURLRouter sharedURLRouter].baseURL];
    [[AZURLRouter sharedURLRouter] openURL:url parameters:parameters from:self animated:animated configuration:configuration];
}

@end
